 // 假设的商品数据
 const products = [
  {
    "id": "1802238840597921794",
    "createUser": "smilexin",
    "shopName": "更新后的商店名称",
    "imageUrl": "http://example.com/newimage.jpg",
    "shopPrice": 29.99,
    "description": "更新后的描述。",
    "typeName": null,
    "supplierName": null,
    "supplierPhone": null,
    "serviceGuarantee": "60天退货政策",
    "express": "FedEx",
    "status": 4,
    "exchangeCap": 15,
    "stock": "150",
    "exchangeAmount": "10",
    "citiesWhitelist": null,
    "citiesBlacklist": "城市C,城市D",
    "createTime": null,
    "updateTime": "2024-06-18T02:46:06.000+00:00",
    "onlineTime": "2022-01-01T00:00:00.000+00:00",
    "offlineTime": "2022-01-01T00:00:00.000+00:00",
    "equityVOList": []
},
{
    "id": "1802238922416209921",
    "createUser": "Smilexin1",
    "shopName": "示例商品",
    "imageUrl": "http://example.com/image.jpg",
    "shopPrice": 1000.0,
    "description": "这是一个示例商品描述",
    "typeName": null,
    "supplierName": null,
    "supplierPhone": null,
    "serviceGuarantee": "退换货服务保证",
    "express": "快递A",
    "status": 2,
    "exchangeCap": null,
    "stock": "50",
    "exchangeAmount": null,
    "citiesWhitelist": null,
    "citiesBlacklist": "城市Z,城市W",
    "createTime": null,
    "updateTime": null,
    "onlineTime": "2022-01-01T00:00:00.000+00:00",
    "offlineTime": "2022-01-01T00:00:00.000+00:00",
    "equityVOList": []
},
{
    "id": "1802241336938635265",
    "createUser": "Smilexin1",
    "shopName": "示例商品",
    "imageUrl": "http://example.com/image.jpg",
    "shopPrice": 1000.0,
    "description": "这是一个示例商品描述",
    "typeName": null,
    "supplierName": null,
    "supplierPhone": null,
    "serviceGuarantee": "退换货服务保证",
    "express": "快递A",
    "status": 1,
    "exchangeCap": null,
    "stock": "50",
    "exchangeAmount": null,
    "citiesWhitelist": null,
    "citiesBlacklist": "城市Z,城市W",
    "createTime": null,
    "updateTime": "2024-06-18T02:47:37.000+00:00",
    "onlineTime": "2022-01-01T00:00:00.000+00:00",
    "offlineTime": "2022-01-01T00:00:00.000+00:00",
    "equityVOList": []
},
{
    "id": "1802897509748674561",
    "createUser": "smilexin",
    "shopName": "更新后的风衣",
    "imageUrl": "https://szml-1317959020.cos.ap-nanjing.myqcloud.com/szml_picture/3432c0efc3044effb62502337f04ad36.png",
    "shopPrice": 120.0,
    "description": "这是一件更新后的风衣，更加时尚。",
    "typeName": null,
    "supplierName": null,
    "supplierPhone": null,
    "serviceGuarantee": "15天无理由退换货",
    "express": "圆通,中通",
    "status": null,
    "exchangeCap": 150,
    "stock": "150",
    "exchangeAmount": "0",
    "citiesWhitelist": "[100011,103421]",
    "citiesBlacklist": "[100012,103422]",
    "createTime": "2024-06-18T02:53:57.000+00:00",
    "updateTime": "2024-06-20T03:47:43.000+00:00",
    "onlineTime": "2022-01-01T00:00:00.000+00:00",
    "offlineTime": "2022-01-01T00:00:00.000+00:00",
    "equityVOList": []
},
{
    "id": "1802899059107794945",
    "createUser": "smilexin",
    "shopName": "优质咖啡豆",
    "imageUrl": "http://example.com/coffeebeans.jpg",
    "shopPrice": 1000.0,
    "description": "来自哥伦比亚的优质咖啡豆。",
    "typeName": null,
    "supplierName": null,
    "supplierPhone": null,
    "serviceGuarantee": "全额退款保证",
    "express": "顺丰速运",
    "status": null,
    "exchangeCap": 100,
    "stock": "50",
    "exchangeAmount": "0",
    "citiesWhitelist": null,
    "citiesBlacklist": "城市C,城市D",
    "createTime": "2024-06-18T03:00:07.000+00:00",
    "updateTime": "2024-06-18T03:00:07.000+00:00",
    "onlineTime": "2022-01-01T00:00:00.000+00:00",
    "offlineTime": "2022-01-01T00:00:00.000+00:00",
    "equityVOList": []
}
];



export default {
  //这是mock的假地址
  'GET /api/mock/page': (req: any, res: any) => {
    // 获取请求参数
    const { pageNum = 1, pageSize = 5 } = req.query;
    // 分页逻辑
    const startIdx = (pageNum - 1) * pageSize;
    const endIdx = startIdx + parseInt(pageSize, 10);
    const pageData = products.slice(startIdx, endIdx);

    // 构造返回数据
    res.json({
      success: true,
      data: {
        list: pageData,
        total: products.length, // 总数据条数，用于前端分页
      },
      errorCode: 0,
    });
  },







 //修改上下线状态
  'POST /api/shops/changeStatus': (req:any, res:any) => {
    const { id, status } = req.body;
    const product = products.find(item => item.id === id);
    if (product) {
      product.status = status;
      res.send({
        code: 200,
        message: '状态修改成功',
      });
    } else {
      res.send({
        code: 404,
        message: '商品未找到',
      });
    }
  },

};




